Skip to content

fix: restore a feed's scroll when its refresh hadn't landed, and give the OP badge a screen-reader name - #359

Merged
therealsama merged 1 commit into
mainfrom
fix/followups-scroll-op-badge
Dec 1, 2026
Merged

therealsama merged 1 commit into
mainfrom
fix/followups-scroll-op-badge

Conversation

@therealsama

@therealsama therealsama commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes the two known limitations left by #358, and a flaky unit test.

What changed

  • Feed scroll after a reload or external link (desktop). If you left a cached feed before its refresh landed, coming back started you at the top. The list is now saved as stale, so coming back restores your scroll and runs the refresh it never got. The mobile viewer reads the same saved state, so it refreshes too.
  • OP badge. aria-label on a plain span isn't read by all screen readers, and axe flags it (aria-prohibited-attr). The visible "OP" is now aria-hidden, with a screen-reader-only "Original poster" next to it. It looks the same.
  • Flaky StoryCard test. One prefetch test gave a second card a random comment count, so its /42 comments/ query also matched 142 or 242 and failed about 1 run in 100. The count is now fixed.

Testing

  • npm run -s lint: passed
  • npm run -s typecheck: passed
  • npm run -s test:run: 1049 passed
  • npx playwright test --project=chromium --project="Mobile Chrome": 433 passed, 9 skipped
  • New tests in StoryList and SwipeStoryViewer, an updated one in useInfiniteStories, plus updated OP assertions in Comment and CommentArticle. Each fails without its fix.
  • Flaky test: with the second card at 142 comments it fails as in CI; with the fixed count it passes.
  • In the browser, axe flags the old badge but not the new one, the badge's size is unchanged, and screen readers now hear "Original poster".

Known limitations

  • On desktop, when the refresh lands after your scroll is restored, the fresh list replaces the stories under your scroll position. This is intended: the feed always shows the latest stories.

@therealsama therealsama changed the title fix: restore a feed's scroll when its refresh hadn't landed, and give the OP badge a screen-reader name fix: keep your place in a feed while it refreshes, and give the OP badge a screen-reader name Nov 30, 2026
@therealsama therealsama changed the title fix: keep your place in a feed while it refreshes, and give the OP badge a screen-reader name fix: restore a feed's scroll when its refresh hadn't landed, and give the OP badge a screen-reader name Dec 1, 2026
… the OP badge a screen-reader name

- Feed: a cached list left before its refresh landed is saved as stale.
  Coming back restores its scroll and still runs the refresh, on desktop
  and in the mobile viewer.
- OP badge: the visible "OP" is aria-hidden, with a screen-reader-only
  "Original poster" next to it, instead of aria-label on a plain span,
  which axe flags (aria-prohibited-attr).
- Test: pin the second card's comment count in a StoryCard prefetch test.
  A random one like 142 also matched /42 comments/, failing about 1 run
  in 100.
@therealsama
therealsama force-pushed the fix/followups-scroll-op-badge branch from 6612032 to d4be78c Compare December 1, 2026 23:19
@therealsama
therealsama enabled auto-merge December 1, 2026 23:47
@therealsama
therealsama merged commit 0a1c181 into main Dec 1, 2026
4 checks passed
@therealsama
therealsama deleted the fix/followups-scroll-op-badge branch December 1, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants